<?php session_start();
mb_internal_encoding('UTF-8');
$host = $_SERVER['HTTP_HOST'];
if ($_SERVER['SERVER_NAME'] == 'localhost'){$uri="/kalender";}else{$uri="";}
if (!isset($_SESSION['id_user']) || $_SESSION['id_user']=='') {
	echo "<script language=Javascript> location.href='http://$host$uri/index.php'; </script>";	
}else{
		
	if (!is_object($bd)){	
		//me conecto a la base de datos
		require("../globals/Db.class.php");
		require("../globals/Conf.class.php");
		$bd=Db::getInstance();	
	}
	
	function is_valid_email($email){
	  $result = true;
	  if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email)) {
	    $result = false;
	  }
	  return $result;	  
	}
	
	$query = "select * from usuarios where bloqueado=0 and super_cliente=1 ";
	$result = $bd->eje($query);
	$num_rows = $bd->numRows($result);
	if ($result && $num_rows>0){
		echo("<br/><div class='f_bold'>Lista de Super Clientes</div><br/> ");		
		for($i=0; $i < $num_rows && $i < 10; $i++){
			$row = $bd->fila($result,0);
			$id = $row["id"];
			$razon_social = $row["razon_social"];
			$cuit = $row["cuit"];
			echo("<div class='uppercase'>- <span class='f_bold'>Raz&oacute;n Social:</span> $razon_social --- <span class='f_bold'>C.U.I.T.:</span> $cuit &nbsp;&nbsp; <input type='button' value='Seleccionar' onclick='selectSuperClient($id)'/></div>");          
		}		
	}else{
		echo("<br/><div class='f_bold'>Lista de Super Clientes</div><br/> ");
		echo "No se han encontrado clientes a los que se le puedan asignar Distribuidores";
	}	
}
?>